﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using LP580.CG;
using System.Text;

public partial class User_UC2GiftClass : System.Web.UI.Page
{
    private int pageIndex = Utils.RQ_int("pi");
    private int pageSize = 12;
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
            bindData();
        bindContrl();
    }

    private void bindData()
    {
        int uid = Master.ua.UserID;
        List<clsGiftProductType> ls = clsGiftProductType.GetCollection(uid);
        PagedDataSource pds = new PagedDataSource();
        pds.DataSource = ls;
        pds.PageSize = pageSize;
        pds.CurrentPageIndex = (pageIndex - 1 < 0) ? 0 : (pageIndex - 1);
        pds.AllowPaging = true;

        ltPage.Text = LvEasyPager.CreateUser("?", pageIndex, pageSize, pds.DataSourceCount);

        StringBuilder sbHtml = new StringBuilder();

        foreach (clsGiftProductType pt in pds)
        {
            sbHtml.AppendLine("<tr>");
            sbHtml.AppendLine("<td><input type=\"checkbox\" id=\"ids\" name=\"ids\" value=\"" + pt.GiftProductTypeID + "\" /></td>");
            sbHtml.AppendLine("<td align=\"left\">" + pt.GiftProductTypeName + "</td>");
            sbHtml.AppendLine("<td>[<a href='UC2GiftClassOperate.aspx?act=goup&id=" + pt.GiftProductTypeID + "' alt='上移'>&uArr;</a> <a href='UC2GiftClassOperate.aspx?act=godown&id=" + pt.GiftProductTypeID + "' alt='下移'>&dArr;</a>] <a class=\"hand\" href=\"UC2GiftClassOperate.aspx?act=edit&id=" + pt.GiftProductTypeID + "\">[修改]</a> <a class=\"hand\" href=\"UC2GiftClassOperate.aspx?act=del&ids=" + pt.GiftProductTypeID + "\" onclick=\"return confirm('删除后无法恢复。\\n\\n确实要删除吗？')\">[删除]</a>");
            sbHtml.AppendLine("</tr>");
        }
        tbodyList.InnerHtml = sbHtml.ToString();
    }

    private void bindContrl()
    {

    }
}